<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="../common.inc" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link href="./css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="./js/form.js"></script>
<script type="text/javascript" language="javascript">
<!--
	function save(){
		var objs = document.getElementsByName("deptId");
		var deptIds = "";
		for(var i = 1; i < objs.length; i++){
			if(objs[i].checked){
				deptIds = deptIds + objs[i].value + ",";
			}
		}
	
		if(deptIds != ""){
			/**document.selectDeptForm.action="./businessTarget.do?action=selectDept&deptIds="+deptIds;
			document.selectDeptForm.target="main";
			document.selectDeptForm.submit();*/
			window.returnValue = deptIds;
			self.close();
		}else{
			alert("<fmt:message key='target.message.assignDept'/>");
		}
	}
-->
</script>
</head>
<body style="margin: 10px 5px 0 5px;">
<form name="selectDeptForm" action="" method="post">
	<div class="tools">
		<input class="btn1" type="button" value="<fmt:message key='common.button.ok2'/>" onclick="save()"/>&nbsp;&nbsp;
		<input class="btn1" type="button" value="<fmt:message key='common.button.cancel2'/>" onclick="window.close();"/>&nbsp;&nbsp;
	</div>

	<table id="tDept" class="table_style" style="text-align: center;">
		<tr>
			<td class="title4" width="5%"><input id="deptId" name="deptId" type="checkbox" value="0" onclick="checkAll('deptId')"/></td>
			<td class="title4"><fmt:message key='dept.lable.deptName'/></td>
		</tr>
		<c:forEach var="dept" items="${departments}">
		<tr>
			<td><input id="deptId" name="deptId" type="checkbox" value="${dept.id}"/></td>
			<td>${dept.deptName}</td>
		</tr>
		</c:forEach>
	</table>
</form>
</body>
</html>